﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using XBLib.Dal;
using XBLib.Dal.AdoDal;
using XBLib.BusinessObject;
using System.Data.Common;
using KenLib.Dal;
using DataInfo;
namespace KenLib.BusinessManager
{
    public class GlobalManager
    {
        //  2011/05/03 - THINH ***************************
        private GlobalDao m_GlobalDao = new GlobalDao();
        public List<CommonObject> Select入国G()
        {
            return m_GlobalDao.Select入国G();
        }
        public List<CommonObject> Select企業By入国G(int 入国GID)
        {
            return m_GlobalDao.Select企業By入国G(入国GID);
        }
        public List<CommonObject> Select実習生By入国G企業(int 入国GID, int 企業ID)
        {
            return m_GlobalDao.Select実習生By入国G企業(入国GID, 企業ID);
        }
        //*************************************************
        /// <summary>
        /// GetAllInfoInTable
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public List<T> GetAllInfoInTable<T>(string tableName) where T : XBLib.BusinessObject.BindableBusinessObject, new()
        {
            return m_GlobalDao.GetAllInfoInTable<T>(tableName);
        }
        public List<T> GetAllInfoInTable<T>(string tableName, string columnOderBy, bool isAsc) where T : XBLib.BusinessObject.BindableBusinessObject, new()
        {
            return m_GlobalDao.GetAllInfoInTable<T>(tableName, columnOderBy, isAsc);
        }
        /// <summary>
        /// GetInfoInTableByValue
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tableName"></param>
        /// <param name="columnName"></param>
        /// <param name="value"></param>
        /// <param name="isString"></param>
        /// <returns></returns>
        public List<T> GetInfoInTableByValue<T>(string tableName, string columnName, string value, bool isString) where T : XBLib.BusinessObject.BindableBusinessObject, new()
        {
            return m_GlobalDao.GetInfoInTableByValue<T>(tableName, columnName, value, isString);
        }
        public List<T> GetInfoInTableByValue<T>(string tableName, string columnName, string value, bool isString, string columnOderBy, bool isAsc) where T : XBLib.BusinessObject.BindableBusinessObject, new()
        {
            return m_GlobalDao.GetInfoInTableByValue<T>(tableName, columnName, value, isString,columnOderBy,isAsc);
        }
        /// <summary>
        /// GetInfoInTableLikeValue
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tableName"></param>
        /// <param name="columnName"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public List<T> GetInfoInTableLikeValue<T>(string tableName, string columnName, string value) where T : XBLib.BusinessObject.BindableBusinessObject, new()
        {
            return m_GlobalDao.GetInfoInTableLikeValue<T>(tableName, columnName, value);
        }
        public List<T> GetInfoInTableLikeValue<T>(string tableName, string columnName, string value, string columnOderBy, bool isAsc) where T : XBLib.BusinessObject.BindableBusinessObject, new()
        {
            return m_GlobalDao.GetInfoInTableLikeValue<T>(tableName, columnName, value, columnOderBy,isAsc);
        }
        /// <summary>
        /// Get data in table and paging(truong hop table chi co 1 column tham gia khoa chinh moi dung dc)
        /// </summary>
        /// <param name="tableName">require param:table name</param>
        /// <param name="columnOtherSelect">ex: (select columnName from tableA A where A.columnKey=columnKey) columnA1</param>
        /// <param name="columnPrimaryKey">require param:columnPrimaryKey</param>
        /// <param name="orderByCommand">require param:  ex:column1 asc,column2 asc</param>
        /// <param name="whereCommand">ex:column1=value2 and column2 like'%value2%'</param>
        /// <param name="pageIndex">require param: page index you want get data</param>
        /// <param name="pageSize">require param: number row you want get </param>
        /// <param name="total">require param: total pages return </param>
        /// <returns></returns>
        public List<T> SelectDataInTableAndPaging<T>(string tableName, string columnOtherSelect, string columnPrimaryKey, string orderByCommand, string whereCommand, int pageIndex, int pageSize, ref int total) where T : XBLib.BusinessObject.BindableBusinessObject, new()
        {
            return m_GlobalDao.SelectDataInTableAndPaging<T>(tableName,columnOtherSelect, columnPrimaryKey, orderByCommand, whereCommand, pageIndex, pageSize,ref total);
        }
        
    }
}
